<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->
<template>
  <el-form ref="form" :model="{ options }" label-width="120px" class="form">
    <el-form-item label="环节名称">
      <el-input v-model="item.taskName"></el-input>
    </el-form-item>
    <el-form-item label="环节key">
      <el-input v-model="item.taskKey"></el-input>
    </el-form-item>
    <template v-if="item.type === nodeType.CCTASK || item.type === nodeType.USERTASK">
      <el-form-item label="">
        <el-checkbox v-model="item.sendNotify" true-label="true" false-label="false" label="发送通知" />
        <el-input v-if="item.sendNotify === 'true'" type="textarea" v-model="item.notifyMsgTemp"></el-input>
      </el-form-item>
    </template>
    <template v-if="item.type === nodeType.USERTASK">
      <el-form-item label="">
        <el-checkbox
          v-model="item.isSign"
          true-label="true"
          false-label="false"
          label="是否多人会签"
          style="margin-right: 10px"
        />
        <el-select v-model="item.signFormId" placeholder="请选择表单">
          <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"> </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-checkbox
          v-model="item.jumpIfRepeat"
          true-label="true"
          false-label="false"
          label="去重"
        />（在改环节之前的环节相同办理人员已经审批过，该人员默认同意无需操作）
      </el-form-item>
      <el-form-item>
        <el-checkbox
          v-model="item.jumpIfMyApplication"
          true-label="true"
          false-label="false"
          label="发起人相同过滤"
        />（当前节点人员和发起人相同时，该人员默认同意无需操作）
      </el-form-item>
      <el-form-item>
        <el-checkbox
          v-model="item.mergeAdjacent"
          true-label="true"
          false-label="false"
          label="相邻节点合并"
        />（当前节点人员和上一个节点人员相同时，该人员默认同意无需操作）
      </el-form-item>
    </template>
  </el-form>
</template>

<script>
import taskAPI from '@/framework-code//api/task'
import { nodeType,template } from '@/framework-code/utils/constants'
import appId from '@/framework-code/utils/appId'
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    }
  },
  mixins: [appId],
  data() {
    return {
      options: [],
      nodeType
    }
  },
  mounted() {
    if (!this.options.length) {
      this.formModelList()
    }
    if (!this.item?.notifyMsgTemp && this.item.type !== nodeType.BRANCHTASK) {
      this.item.notifyMsgTemp = this.item.type !== nodeType.CCTASK ? template.task : template.cc
    }
  },
  watch: {
    item: {
      handler(val, oldVal) {
        this.$emit('on-item', val)
      },
      deep: true
    }
  },
  methods: {
    async formModelList() {
    }
  }
}
</script>

<style scoped>
.form {
  padding: 20px;
}
</style>
